home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / src / inc-dec-nshell.hqx / inc-dec / How To (dec) < prev    next >
Encoding:
Text File  |  1994-10-20  |  888 b   |  48 lines

  1. How To
  2. ======
  3.  
  4. To use this command, drop the "dec" file into your nShell "bin" directory.
  5.  
  6. Description
  7. ===========
  8.  
  9. NAME
  10.  
  11. dec - Decrement a variable
  12.  
  13. SYNOPSIS
  14.  
  15. dec variable [offset]
  16.  
  17. DESCRIPTION
  18.  
  19. This command will subtract an offset from a numeric variable:
  20.  
  21. variable = variable - offset
  22.  
  23. RETURN CODES
  24.  
  25. <0    Error
  26. 0    The result of the decrement is greater than zero.
  27. 1    The result of the decrement is less than or equal to zero.
  28.  
  29. Note
  30. ====
  31.  
  32. In normal usage, the variable name should not have a leading '$'.  Remember that "$name" forces an immediate interpretation, so that given:
  33.  
  34. set foo 5
  35. set bar foo
  36.  
  37. The command "dec foo" would decrement the value of "foo" to 4.  The command "dec $bar" would accomplish the same thing, by first interpreting "$bar" to mean "foo" and then decrementing the contents of "foo".
  38.  
  39. Example
  40. =======
  41.  
  42. set foo 6
  43.  
  44. while dec foo do
  45.  echo "waiting..."
  46.  delay 1
  47. done
  48.